﻿using CNI.Models;
using CNI.Repository.Table;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.Storage;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CNI.Repository.Factory
{
    public class TableIngestFactory : IIngestRepositoryFactory
    {
        public Repostitory.Interface.IIngestRepository<T> CreateIngestRepository<T>()
        {
            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
                CloudConfigurationManager.GetSetting("StorageConnectionString"));
            var storageTableName = CloudConfigurationManager.GetSetting("IngestTableName");
            var partitionKeyPropertyName = CloudConfigurationManager.GetSetting("TableIngestPartitionKeyName");
            return new TableIngestion<T>(storageAccount, storageTableName, partitionKeyPropertyName);
        }
    }
}
